package edu.bu.met683.TravelDroid.Tests;

import java.util.List;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;

public class TourListAdapter extends BaseAdapter {
	//private properties
	private final Context context;
	private final List<Tour> tours;

	//constructors
	public TourListAdapter(final Context context, final List<Tour> tours) {
		super();
		this.context = context;
		this.tours = tours;
	}
	
	//public methods
	public int getCount() {
		return this.tours.size();
	}

	public Object getItem(int position) {
		return this.tours.get(position);
	}

	public long getItemId(final int position) {
		return (long)position;
	}

	public View getView(final int position, final View convertView, final ViewGroup parent) {
		Tour tour = this.tours.get(position);
		return new TourListView(context, tour.getName(), tour.getLength(), tour.getDescription(), tour.getProximity());
	}
	
	

}
